//
//  TopicOtherCollectionViewCell.m
//  礼物go
//
//  Created by dllo on 16/5/25.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TopicOtherCollectionViewCell.h"

@interface TopicOtherCollectionViewCell ()

@property(nonatomic,strong)UILabel *titleLabel;
@property(nonatomic,strong)UIImageView *backImageView;

@end

@implementation TopicOtherCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

-(void)createSubviews{
    self.backImageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.contentView.frame.size.width - 66) / 2, 0, 66, 66)];
    self.backImageView.layer.masksToBounds = YES;
    self.backImageView.layer.cornerRadius = 33;
    //self.backImageView.backgroundColor = [UIColor purpleColor];
    [self.contentView addSubview:self.backImageView];

self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.backImageView.frame.origin.y + self.backImageView.frame.size.height, self.contentView.frame.size.width, self.contentView.frame.size.height - self.backImageView.frame.origin.y - self.backImageView.frame.size.height)];
   //self.titleLabel.dk_backgroundColorPicker = DKColorPickerWithRGB(0xFFFAFA,0xBEBEBE);
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleLabel.font = [UIFont systemFontOfSize:15];

}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.backImageView.frame = CGRectMake((self.contentView.frame.size.width - 66) / 2, 0, 66, 66);
    self.titleLabel.frame = CGRectMake(0, self.backImageView.frame.origin.y + self.backImageView.frame.size.height, self.contentView.frame.size.width, self.contentView.frame.size.height - self.backImageView.frame.origin.y - self.backImageView.frame.size.height);
}

-(void)setDetailModel:(TopicOtherTDetailModel *)detailModel{
    _detailModel = detailModel;
    [self.backImageView sd_setImageWithURL:[NSURL URLWithString:_detailModel.icon_url] placeholderImage:[UIImage imageNamed:@"picholder"]];
    self.titleLabel.text = _detailModel.name;
}




@end
